<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>表单模块 - layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="format-detection" content="telephone=no">

  <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">

<style>
body{padding: 10px;}
</style>
</head>
<body>
<div class="tplay-body-div">
    <div class="layui-tab">
      <ul class="layui-tab-title">
        <li><a href="{:url('admin/diao_cha/index')}" class="a_menu">情感调查管理</a></li>
        <li class="layui-this" id="aaa">添加问题</li>
      </ul>
    </div>
<form class="layui-form" id="form"  enctype='multipart/form-data'>
<input type="hidden" name="id" value="{$row.id??''}">
   <div class="layui-form-item" id="admin">
        <label class="layui-form-label">问题题目</label>
        <div class="layui-input-block" style="max-width:600px;">
          <input name="title" lay-verify="title" autocomplete="off" placeholder="请输入问题题目" class="layui-input" type="text" value="{$row.title??''}">
        </div>
      </div>
       <div class="layui-form-item" id="admin">
        <label class="layui-form-label">A选项</label>
        <div class="layui-input-block" style="max-width:600px;">
          <input name="a" lay-verify="title" autocomplete="off" placeholder="请输入A选项" class="layui-input" type="text" value="{$row.a??''}">
        </div>
      </div>
       <div class="layui-form-item" id="admin">
        <label class="layui-form-label">B选项</label>
        <div class="layui-input-block" style="max-width:600px;">
          <input name="b" lay-verify="title" autocomplete="off" placeholder="请输入B选项" class="layui-input" type="text" value="{$row.b??''}">
        </div>
      </div>
       <div class="layui-form-item" id="admin">
        <label class="layui-form-label">C选项</label>
        <div class="layui-input-block" style="max-width:600px;">
          <input name="c" lay-verify="title" autocomplete="off" placeholder="请输入C选项" class="layui-input" type="text" value="{$row.c??''}">
        </div>
      </div>
      
  <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="admin">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>

<br><br><br>


<script src="__PUBLIC__/layui/layui.js"></script>
    <script src="__PUBLIC__/jquery/jquery.min.js"></script>
    <script src="__JS__/form.js"></script>
    <script src="__JS__/layer.js"></script>
<script>
      
      layui.use(['layer', 'form'], function() {
          var layer = layui.layer,
              $ = layui.jquery,
              form = layui.form;
          $(window).on('load', function() {
              form.on('submit(admin)', function(data) {
                  
          $("#form").ajaxSubmit({
          type: 'post',  
          dataType:"json",
          url:"{:url('admin/diao_cha/add')}",
          success: function(res){
            <!-- console.log(res);return false; -->
            if(res.code == 1) {
              layer.alert(res.msg, function(index){
                location.href = res.url;
              })
            } else {
              layer.msg(res.msg);
              }
          },  
          error: function(XmlHttpRequest, textStatus, errorThrown){  
            alert( "error");  
          }  
        });
                  return false;
              });
          });
      });
    </script>

</body>
</html>
